package com.finance.capacity.common.controller;

import com.finance.capacity.common.bean.pojo.CapOrganization;
import com.finance.capacity.common.capService.ICapOrganizationService;
import com.finance.framework.controller.BaseController;
import com.finance.framework.controller.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: gly
 * @Date: Created in 2017-08-29
 */
@Controller
@RequestMapping("/capacity/common")
public class CommonController  extends BaseController {
    @Resource
    private ICapOrganizationService capOrganizationService;

    /**
     * 获取省公司列表
     * @return
     */
    @RequestMapping("/provinces")
    public Result provinceCompanyList(){
        List<CapOrganization> provinceCompanyList =capOrganizationService.provinceCompanies();
        return getSuccessResult(provinceCompanyList);
    }

    /**
     * 获取市公司列表
     * @param provinceCompanyCode
     * @return
     */
    @RequestMapping("/cities")
    public Result  cityCompanyList(String provinceCompanyCode ){
        List<CapOrganization> cityCompanyList =capOrganizationService.cityCompanies(provinceCompanyCode);
        return getSuccessResult(cityCompanyList);
    }

    /**
     *  获取站点列表
     * @param cityCompanyCode
     * @return
     */
    @RequestMapping("/sites")
    public Result siteList(String cityCompanyCode){
        List<CapOrganization> siteList =capOrganizationService.sites(cityCompanyCode);
        return getSuccessResult(siteList);
    }

}
